package com.hexiaohe.springboot_vue_app.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hexiaohe.springboot_vue_app.entity.Fruit;
import com.hexiaohe.springboot_vue_app.mapper.FruitMapper;
import com.hexiaohe.springboot_vue_app.service.FruitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FruitServiceImpl implements FruitService {
    @Autowired
    FruitMapper fruitMapper;
    @Override
    public Page<Fruit> findpage(Page<Fruit> page) {
        return fruitMapper.findpage(page);
    }

    @Override
    public int addFruit(Fruit fruit) {
        return fruitMapper.insert(fruit);
    }

    @Override
    public int updateById(Fruit fruit) {
        return fruitMapper.updateById(fruit);
    }

    @Override
    public int deleteFruitById(int id) {
        return fruitMapper.deleteById(id);
    }

    @Override
    public List<Fruit> getFruitList() {
        return fruitMapper.selectList(null);
    }
}
